import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class IteratorDemo {
    public static void main(String[] args) {
        Collection<String> clt = new ArrayList<>();
        clt.add("Hello");
        clt.add("World");
        clt.add("Java");
        clt.add("Java");
        System.out.println(clt);
        System.out.println(clt.size());
        Iterator<String> it = clt.iterator();
        while(it.hasNext()){
            String s = it.next();
            System.out.println(s);
        }
    }
}
